//
//  PhotoSetModel.m
//  item-NetEaseNews-tyw
//
//  Created by tyw on 15/10/2.
//  Copyright (c) 2015年 tyw. All rights reserved.
//

#import "PhotoSetModel.h"
#import "PhotoModel.h"

@implementation PhotoSetModel

- (NSDictionary*)attributeMapDictionary{
    
    //@"属性名": @"数据字典的key"
    NSDictionary *mapAtt = @{@"autoId":@"autoid",
                             @"boardId":@"boardid",
                             @"clientadUrl":@"clientadurl",
                             @"commentUrl":@"commenturl",
                             @"firstImgUrl":@"cover",
                             @"createDate":@"createdate",
                             @"creator":@"creator",
                             @"dataTime":@"datatime",
                             @"introduce":@"desc",
                             @"imgCount":@"imgsum",
                             @"postId":@"postid",
                             @"reporter":@"reporter",
                             @"source":@"source",
                             @"title":@"setname",
                             @"newsTags":@"settag",
                             @"littleImgUrl":@"scover",
                             @"middleImgUrl":@"tcover",
                             @"newsWebUrl":@"url"};
    
    return mapAtt;
}

- (void)setAttributes:(NSDictionary *)dataDic {
    [super setAttributes:dataDic];
    
    //配置  单张图片  的数据模型, 组成的数组
    NSArray* array = [dataDic objectForKey:@"photos"];
    NSMutableArray* photoModelArray = [[NSMutableArray alloc] init];
    if (array.count) {
        
        for (NSDictionary* dic in array) {
            PhotoModel* photoModel = [[PhotoModel alloc] initWithDataDic:dic];
            
            [photoModelArray addObject:photoModel];
        }
        
        _photoModelArray = [photoModelArray copy];
    }
}

@end
